﻿using System;
using Business;

namespace ServicesDirectory
{
    public partial class ForgotPassword : System.Web.UI.Page
    {
        protected void PageLoad(object sender, EventArgs e)
        {
            
        }

        

        protected void BtnSubmitClick(object sender, EventArgs e)
        {
            var userBusiness = new UserBusiness();
            var account = TxtUserName.Text;
            var email = TxtEmail.Text;
            var checkEmail = userBusiness.ValidateEmail(account, email);
            if (checkEmail)
            {
                lblStatus.Text = "";
                CaptchaControl1.ValidateCaptcha(TxtCaptcha.Text);
                if (CaptchaControl1.UserValidated)
                {
                    string message = "";
                    var result = userBusiness.ForgotPassword(account, email,out message);
                    //lblStatus.Text = result;
                    if (result)
                    {
                        //lblStatus.Text = "Please check your email to get password!";
                        lblStatus.Text = message;
                    }
                }
            }
            else
            {
                lblStatus.Text = "Username and Email do not match!";
            }
        }
    }
}
